package com.common.utils;

import java.util.regex.Pattern;

public class ValidationUtils {
    // 常用正则（平衡准确性和性能）
    private static final Pattern EMAIL_PATTERN = Pattern.compile(
            "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"
    );

    public static boolean isValidEmail(String email) {
        return email != null && EMAIL_PATTERN.matcher(email).matches();
    }

    public static boolean isEmpty(String text) {
        return text == null || text.trim().isEmpty();
    }
}
